<template>
  <a-drawer v-model:open="open" width="70%" :root-style="{ color: 'blue' }" style="color: red" title="日志分析"
    placement="right">
    <div class="top" style="display: flex;justify-content: space-between;gap:20px">
      <div style="flex:0 1 60%">
        <a-card> 
           <WsChart  height="500px" :option="reactiveModuleOption"/>
        </a-card> 
      </div>
      <div style="flex:0 1 40%">
        <a-card> 
           <WsChart  height="500px" :option="reactiveSuccessOption"/>
        </a-card> 
      </div>
      <!-- <WsBarChart widthProp="50%" heightProp="100%" :categories="barCategories" title="模块访问量" :series="barSeries">
      </WsBarChart> -->
        
      <!-- <WsPieChart widthProp="50%" heightProp="100%" :data="pieData" title="成功失败"></WsPieChart> -->


    </div>

    <div class="top" style="display: flex; margin-top: 20px;">
      <div style="flex:1">
          <a-card> 
           <WsChart  height="500px" :option="reactiveStaticsOption"/>
          </a-card>
      </div>
    </div>
    

 
   
  </a-drawer>

</template>

<script setup name="LogModal">

import WsChart  from '@/components/WsChart.vue';
import moduleOption from '@/utils/echart/logs/module';
import successOption from '@/utils/echart/logs/success';
import staticsOption from '@/utils/echart/logs/statics';
const reactiveModuleOption = reactive(moduleOption)
const reactiveSuccessOption = reactive(successOption)
const reactiveStaticsOption = reactive(staticsOption)

const open = ref(false)
onMounted(()=>{
  
  reactiveModuleOption.series.data =[100, 90, 82, 60, 50, 20];
  reactiveModuleOption.xAxis.data=["用户", '角色', '菜单', '日志', 'InfluxDB'];

  reactiveSuccessOption.series[0].data= [
   { value: 20, name: '成功' },
   { value: 1, name: '失败' }
  ]
  reactiveStaticsOption.legend.data= ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
  reactiveStaticsOption.xAxis.data=['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  reactiveStaticsOption.series=[{
      name: 'Email',
      type: 'line',
      stack: 'Total',
      data: [120, 132, 101, 134, 90, 230, 210]
    },
    {
      name: 'Union Ads',
      type: 'line',
      stack: 'Total',
      data: [220, 182, 191, 234, 290, 330, 310]
    },
    {
      name: 'Video Ads',
      type: 'line',
      stack: 'Total',
      data: [150, 232, 201, 154, 190, 330, 410]
    },
    {
      name: 'Direct',
      type: 'line',
      stack: 'Total',
      data: [320, 332, 301, 334, 390, 330, 320]
    },
    {
      name: 'Search Engine',
      type: 'line',
      stack: 'Total',
      data: [820, 932, 901, 934, 1290, 1330, 1320]
    }]
  })

//设置弹框的开闭 
const openModal = async () => {
  open.value = true;

}
//关闭弹框
const cancel = e => {
  open.value = false
}

//在这里暴露这个方法 在外面调用
defineExpose({ openModal })

</script>

<style scoped></style>